import java.util.Objects;

public class person {
    private String name;
    private int age;

    public person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void eat(){
        System.out.println(this.name+"正在吃饭");
    }

    @Override
    public boolean equals(Object obj) {
        if(obj==null) {
            return false;
        }
        if(obj==this){
            return true;
        }
        if(!(obj instanceof person)){
            return false;
        }
        person person=(person)obj;
        return this.name.equals(person.name) && this.age==person.age;
    }

    @Override
   public int hashCode() {
        return Objects.hash(name,age);
    }

   /* @Override
    public int hashCode() {
        return super.hashCode();
    }*/
}
